package polymorphism;

import static net.mindview.util.Print.print;

public enum  Note {//音符
    MIDDLE_C,C_SHARP,B_FLAT;
}
class Instrument{//乐器
    public void play(Note n){
        print("Instrument.play()");
    }
}
class Wind extends Instrument{//风管
    public void play(Note n){
        System.out.println("Wind.play()"+n);
    }
}
class Stringed extends Instrument{//弦管
    public void play(Note n){
        System.out.println("Stringed.play()"+n);
    }
}
class Brass extends Instrument{
    public void play(Note n){
        System.out.println("Brass.play()"+n);
    }
}
class Music{//音乐
    public static void tune(Instrument i){//曲子
        i.play(Note.MIDDLE_C);
    }

    public static void main(String[] args) {
            Wind wind=new Wind();
            tune(wind);
            Stringed stringed=new Stringed();
//            Music music=new Music();
//            music.tune();
    }
}
class Music2{
    public static void tune(Wind w){
        w.play(Note.C_SHARP);
    }
    public static void tune(Stringed s){
        s.play(Note.MIDDLE_C);
    }
    public  static void tune(Brass b){
        b.play(Note.MIDDLE_C);
    }

    public static void main(String[] args) {
        Wind wind=new Wind();
        Stringed stringed=new Stringed();
        Brass brass=new Brass();
        tune(wind);tune(stringed);tune(brass);
    }
}